package controller

import (
	"gincli/app/index/model"
	"gincli/lib/panda_redis"
	"github.com/gin-gonic/gin"
	"net/http"
	"time"
)

func (i IndexController) Index(c *gin.Context) {
	m := model.User{}
	//m.GetOne(1)
	ids := []int{1, 2}
	users := m.ListUsers(ids)
	//redis写入
	panda_redis.SetRedis(c, "name", "作者自拍照", time.Second*60*20) //duration 20分钟转纳秒
	c.JSON(http.StatusOK, gin.H{
		"data": users,
	})
}

func (i IndexController) Welcome(c *gin.Context) {
	//redis读取
	dou := panda_redis.GetRedis(c, "name")
	c.HTML(http.StatusOK, "index/index.html", dou)

}
